import { withRoutePage } from '@/utils/enhanceUtils';
import { connect } from 'umi';
import { Form } from 'antd';
import { RecheckColumnProcessor, Recheck } from '@/pages/SalaryManage/SalaryCalculate/Recheck/BaseRecheck';
import modelType from '@/pages/SalaryManage/SalaryCalculate/constant/modelTypeConstant';

const RecheckWithForm = Form.create({ name: 'FinancialRecheck' })(Recheck);

const namespace = 'financialRecheckModel';
const shareNamespace = 'recheckSharedModel';

const DISPATCH_TYPE = {
    initType: `${namespace}/${modelType.E_INIT}`,
    [modelType.E_RESET]: `${namespace}/${modelType.E_RESET}`,
    searchType: `${namespace}/${modelType.E_SEARCH}`,
    searchCondition: `${namespace}/${modelType.E_SEARCH_CONDITION}`,
    tablePageChangeType: `${namespace}/${modelType.E_TABLE_PAGE_CHANGE}`,
    selectRow: `${namespace}/${modelType.SET_SELECTED_ROW}`,
    confirmItemRecheckType: `${namespace}/${modelType.E_CONFIRM_ITEM_RECHECK}`,
    approveSubmitType: `${namespace}/${modelType.E_APPROVE_SUBMIT}`,
    sendSalaryPayrollType: `${namespace}/${modelType.E_SEND_SALARY_PAYROLL}`,
    applyPaymentType: `${namespace}/${modelType.E_APPLY_PAYMENT}`,
    passCheckBatchType: `${namespace}/${modelType.E_PASS_CHECK_BATCH}`,
    updateDataType: `${namespace}/${modelType.E_UPDATE_DATA}`,
    postponeNextMonthType: `${namespace}/${modelType.E_POSTPONE_NEXT_MONTH}`,
    excelExportType: `${namespace}/${modelType.E_EXCEL_EXPORT}`,
    setModalVisibleType: `${namespace}/${modelType.SET_MODAL_VISIBLE}`,
    rejectInitType: `${namespace}/${modelType.E_REJECT_INIT}`,
    reject: `${namespace}/${modelType.E_REJECT}`,
    batchReject: `${namespace}/${modelType.E_BATCH_REJECT}`,
    cancelCheckType: `${namespace}/${modelType.E_CANCEL_CHECK}`,
    passCheckType: `${namespace}/${modelType.E_PASS_CHECK}`,
    sharedState: `${shareNamespace}/${modelType.E_SHARED_STATE}`
};
const columnProcessor = RecheckColumnProcessor(DISPATCH_TYPE);
export default withRoutePage(
    connect(({ financialRecheckModel, recheckSharedModel, articleWagesModel, rejectTabModel }) => ({
        ...financialRecheckModel,
        ...recheckSharedModel,
        ...articleWagesModel,
        ...rejectTabModel,
        columnProcessor,
        dispatchType: DISPATCH_TYPE
    }))(RecheckWithForm)
);
